export const columns = (that) => {
    return [{
        type: 'index', title: '序号', width: 80, align: 'center',
    }, {
        key: 'orderNo', title: '订单编号', minWidth: 160, align: 'center',
    }, {
        key: 'orderMoney', title: '订单金额', minWidth: 60, align: 'center',
        render: (h, params) => {
            return h('div', [
                (params.row.orderMoney / 100).toFixed(2)
            ])
        }
    }, {
        key: 'paidMoney', title: '支付金额', minWidth: 60, align: 'center',
        render: (h, params) => {
            return h('div', [
                (params.row.paidMoney / 100).toFixed(2)
            ])
        }
    }, {
        key: 'cashMoney', title: '支付现金', minWidth: 60, align: 'center',
        render: (h, params) => {
            return h('div', [
                (params.row.cashMoney / 100).toFixed(2)
            ])
        }
    }, {
        key: 'payType', title: '支付方式', minWidth: 75, align: 'center',
        render: (h, params) => {
            var v;
            if (params.row.payType == 'CASH') {
                v = '现金'
            } else if (params.row.payType == 'ALI') {
                v = '支付宝'
            } else if (params.row.payType == 'WX') {
                v = '微信'
            } else if (params.row.payType == 'ALI_CASH') {
                v = '支付宝+现金'
            } else if (params.row.payType == 'WX_CASH') {
                v = '微信+现金'
            } else if (params.row.payType == 'SZ') {
                v = '赊账'
            }
            return h('div', {
                class: params.row.orderStatus == 'PAID' ? 'status-paid' : 'status-unpaid',
            }, [
                v
            ])
        }
    }, {
        key: 'orderStatus', title: '订单状态', minWidth: 60, align: 'center', render: (h, params) => {
            var v;
            if (params.row.orderStatus == 'UNPAID') {
                v = '未支付'
            } else if (params.row.orderStatus == 'PAID') {
                v = '已支付'
            }
            return h('div', {
                class: params.row.orderStatus == 'PAID' ? 'status-paid' : 'status-unpaid',
            }, [
                v
            ])
        }
        // }, {
        //     key: 'username', title: '操作人员', minWidth: 120, align: 'center',
    }, {
        key: 'action', title: '操作', align: 'center', fixed: 'right', width: '175', render: (h, params) => {
            return h('div', [h(
                'Button',
                {
                    props: {
                        type: 'primary',
                        size: 'small',
                        // disabled: params.row.name == '管理员'
                    },
                    style: {
                        marginRight: '2px'
                    },
                    on: {
                        click: () => {
                            that.details(params.row)
                        }
                    }
                },
                '详情'
            ), h('CustomPopTipButton', {
                props: {
                    confirmTitle: '确定删除？', btnType: 'error', btnSize: 'small', btnText: '删除', // icon: 'md-trash',
                    // disabled: params.row.name === '管理员'
                }, on: {
                    ok: () => {
                        that.deleteOrder(params.row.id)
                    },
                },
            }, '删除')])
        }
    }]
}